Local Data Storage on Mobile Devices

The Digitise Apps Client stores data downloaded from your data sources, data entered on the device and internal configuration settings in one or more local SQLite-based databases (the Digitise Apps Client Databases) on the device.

 

When you create an app in App Studio, you define Data Sources to hold the data used by the app. These Data Sources can be linked to remote databases, Web APIs or web services to allow the app to download and/or upload data, or simply to specify tables to hold locally-entered data. Each Data Source equates to a database with one or more tables and specifies the data items which will make up the records in each table. These tables will be created within a local database on the device when a user runs the app. You can use a default database to store these tables, or you can specify an alternative database, if you want to. You can even add tables from different Data Sources to the same local database.

When data is downloaded to a mobile device it is stored in a local database, within the Table you defined in the Data Source. Your apps can then access the data in the local database reading in data to be displayed within the Controls on a form and writing edited data back to the local Table. Record Scripting Methods, such as 'next record', you call within your apps are performed on the records stored in these local databases.

When you create a new record, although this record becomes the current record, it is initially stored in memory until you instruct your app to write it to the local database.

Modified records (including new records which have been written to the local database) can be uploaded back to your back-office systems via the App Server which can update the back-office systems either directly or through a Web API or web service interface. A flag within each record is used to keep track of which records have been created or changed and only new or modified records are sent when uploading data to a remote data source. If a record is successfully uploaded, this flag is set to unchanged, so that it won't be uploaded again, unless it is subsequently changed again.

  • Due to restrictions in the versions of SQL used on the Client devices, VARIANT data types are not supported and so App Studio will not allow these data items to be included in a Data Source. If you attempt to do so, an error message will be displayed.

 

In addition to creating apps which interact with back-office systems, you can create apps which don't have any connection to external data. In this case, you can create one or more local databases and tables to store the information used and/or entered in these apps.

 

Data is stored in the Client Database on the device in an encrypted format (AES 256-bit).

The App Manager Configuration options also allow you to optionally supply your own password to be incorporated into the encryption cipher used to encrypt the databases on your devices and to choose whether to encrypt data whilst in transit between your mobile devices and the App Server, using an AES 256 bit cipher with or without certificate-based private key exchange, to encrypt the data.

 

By default, a table created within a Data Source will be added to the default database:

<applicationname>_DB.db

where <applicationname> is the name of the Digitise Apps Project containing the Data Source. However, you can specify a different database to use if you want to, for example, where you want to separate 'static' reference data from 'live' data. This is done in App Studio using the Device Database Property, within the Properties for the Data Source Table. The default value for this Property is <default>, which means the Table will be added to the default database. To use a different database, simply replace <default> with the name you want to use for the database. You can type the name in the Property's edit box. If this database doesn't already exist on the mobile device, it will be created at runtime.

When entering a database name in the Device Database Property, note the following:

  • Enter the name of the database without any file extension.

  • You can share a database between different apps by prefixing the database name with %SHARE%\, e.g. %SHARE%\MyAppData. Shared databases are stored in the Digitise Apps' Applications folder on the device instead of in the individual app-specific folders so they can be accessible to all apps.

 

In addition to the Device Database Property each Table in a Data Source has a Device Table Property. You can use this Property to 'link' Data Sources, allowing different target Data Sources to point to the same Table within a database. You can use this to separate retrieving and updating of data, for example, where you only want to upload a sub-set of the downloaded fields, or you want to download from one Data Source and upload a sub-set of the fields to a second, different, Data Source.

To link Data Sources in this way, you simply edit their Device Table Properties and give it the same value for each Data Source you want to link. The mapped data in the local storage is defined by the first Data Source (the primary Data Source) in the list of Data Sources in the Data Sources Pane tree view in App Studio. Secondary linked Data Sources must only contain a subset of the mapped data defined in the primary Data Source and data items must have the same names in each Data Source.

  • Data Sources are listed in the Data Source Pane in alphabetical order from A to Z. Therefore, to link Data Sources in this way, make sure the primary data source has a name which will put it highest in the Data Sources tree view.

 

There are several ways of downloading data to your mobile devices when your app is running. For example, you can update an individual table or you can update all the tables in a specified database at once and you can specify a filter to select the records you want to be downloaded. In addition, there are also various options for handling, displaying and updating the data stored in your local database(s) and uploading your changes to your back-office systems. The options available to you depend upon the types of Data Sources you are using and your users' and app's requirements – refer to the Scripting Methods for more information about handling data within your apps.